Optimal. Leaf size=108 \[ \frac {(B-2 C) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac {(B-4 C) \tan (c+d x)}{3 a^2 d}-\frac {(B-2 C) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac {(B-C) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.23, antiderivative size = 108, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 40, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.175, Rules used = {4157, 4104,
4093, 3872, 3855, 3852, 8} \begin {gather*} -\frac {(B-4 C) \tan (c+d x)}{3 a^2 d}+\frac {(B-2 C) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac {(B-2 C) \tan (c+d x)}{a^2 d (\sec (c+d x)+1)}+\frac {(B-C) \tan (c+d x) \sec ^2(c+d x)}{3 d (a \sec (c+d x)+a)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 3872
Rule 4093
Rule 4104
Rule 4157
Rubi steps
\begin {align*} \int \frac {\sec ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx &=\int \frac {\sec ^3(c+d x) (B+C \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx\\ &=\frac {(B-C) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}+\frac {\int \frac {\sec ^2(c+d x) (2 a (B-C)-a (B-4 C) \sec (c+d x))}{a+a \sec (c+d x)} \, dx}{3 a^2}\\ &=-\frac {(B-2 C) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac {(B-C) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}-\frac {\int \sec (c+d x) \left (-3 a^2 (B-2 C)+a^2 (B-4 C) \sec (c+d x)\right ) \, dx}{3 a^4}\\ &=-\frac {(B-2 C) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac {(B-C) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}-\frac {(B-4 C) \int \sec ^2(c+d x) \, dx}{3 a^2}+\frac {(B-2 C) \int \sec (c+d x) \, dx}{a^2}\\ &=\frac {(B-2 C) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac {(B-2 C) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac {(B-C) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}+\frac {(B-4 C) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 a^2 d}\\ &=\frac {(B-2 C) \tanh ^{-1}(\sin (c+d x))}{a^2 d}-\frac {(B-4 C) \tan (c+d x)}{3 a^2 d}-\frac {(B-2 C) \tan (c+d x)}{a^2 d (1+\sec (c+d x))}+\frac {(B-C) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \sec (c+d x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(245\) vs. \(2(108)=216\).
time = 1.10, size = 245, normalized size = 2.27 \begin {gather*} \frac {\cos ^2\left (\frac {1}{2} (c+d x)\right ) \sec (c+d x) \left (-3 (B-2 C) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )-4 (B-C) \csc ^3(c+d x) \sin ^4\left (\frac {1}{2} (c+d x)\right )+16 (B-C) \csc ^5(c+d x) \sin ^8\left (\frac {1}{2} (c+d x)\right )+(-4 B+13 C) \tan \left (\frac {1}{2} (c+d x)\right )+3 (B-2 C) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \tan ^2\left (\frac {1}{2} (c+d x)\right )+(4 B-7 C) \tan ^3\left (\frac {1}{2} (c+d x)\right )\right )}{3 a^2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.48, size = 134, normalized size = 1.24
method | result | size |
derivativedivides | \(\frac {-\frac {B \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}+\frac {C \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}-3 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+5 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (4 C -2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {2 C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-4 C +2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {2 C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{2 d \,a^{2}}\) | \(134\) |
default | \(\frac {-\frac {B \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}+\frac {C \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3}-3 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+5 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (4 C -2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {2 C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-4 C +2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {2 C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{2 d \,a^{2}}\) | \(134\) |
norman | \(\frac {\frac {\left (4 B -9 C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}+\frac {3 \left (B -3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}-\frac {\left (B -2 C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}-\frac {\left (B -C \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 a d}-\frac {\left (13 B -34 C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 a d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3} a}+\frac {\left (B -2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2} d}-\frac {\left (B -2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{2} d}\) | \(192\) |
risch | \(-\frac {2 i \left (3 B \,{\mathrm e}^{4 i \left (d x +c \right )}-6 C \,{\mathrm e}^{4 i \left (d x +c \right )}+9 B \,{\mathrm e}^{3 i \left (d x +c \right )}-18 C \,{\mathrm e}^{3 i \left (d x +c \right )}+7 B \,{\mathrm e}^{2 i \left (d x +c \right )}-22 C \,{\mathrm e}^{2 i \left (d x +c \right )}+9 B \,{\mathrm e}^{i \left (d x +c \right )}-24 C \,{\mathrm e}^{i \left (d x +c \right )}+4 B -10 C \right )}{3 d \,a^{2} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{a^{2} d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{a^{2} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{a^{2} d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{a^{2} d}\) | \(227\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 244 vs.
\(2 (104) = 208\).
time = 0.27, size = 244, normalized size = 2.26 \begin {gather*} \frac {C {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} - \frac {a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - B {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.07, size = 195, normalized size = 1.81 \begin {gather*} \frac {3 \, {\left ({\left (B - 2 \, C\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (B - 2 \, C\right )} \cos \left (d x + c\right )^{2} + {\left (B - 2 \, C\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left ({\left (B - 2 \, C\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (B - 2 \, C\right )} \cos \left (d x + c\right )^{2} + {\left (B - 2 \, C\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, {\left (2 \, B - 5 \, C\right )} \cos \left (d x + c\right )^{2} + {\left (5 \, B - 14 \, C\right )} \cos \left (d x + c\right ) - 3 \, C\right )} \sin \left (d x + c\right )}{6 \, {\left (a^{2} d \cos \left (d x + c\right )^{3} + 2 \, a^{2} d \cos \left (d x + c\right )^{2} + a^{2} d \cos \left (d x + c\right )\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {B \sec ^{3}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx + \int \frac {C \sec ^{4}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx}{a^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.51, size = 151, normalized size = 1.40 \begin {gather*} \frac {\frac {6 \, {\left (B - 2 \, C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {6 \, {\left (B - 2 \, C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} - \frac {12 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a^{2}} - \frac {B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 9 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 15 \, C a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.86, size = 120, normalized size = 1.11 \begin {gather*} \frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (B-2\,C\right )}{a^2\,d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (B-C\right )}{6\,a^2\,d}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {B-C}{a^2}+\frac {B-3\,C}{2\,a^2}\right )}{d}-\frac {2\,C\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-a^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________